package guda.house.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.house.dal.dao.WxPayDetailDAO;
import guda.house.dal.dataobject.WxPayDetailDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WxPayDetailDAOImpl extends BaseDAO implements WxPayDetailDAO {

    @Override
	public Long insert(WxPayDetailDO wxPayDetail) {
	      try {
                return (Long) getSqlMapperW().insert("wx_pay_detail.insert",wxPayDetail);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public WxPayDetailDO getWxPayDetailById(Long detailId) {
	    return (WxPayDetailDO)getSqlMapClientTemplate().queryForObject("wx_pay_detail.getWxPayDetailById", detailId);
	}

    @Override
	public boolean delWxPayDetailById(Long detailId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("wx_pay_detail.delWxPayDetailById",detailId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<WxPayDetailDO> getWxPayDetailByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("wx_pay_detail.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long detailId) {
	    try {
            getSqlMapperW().update("wx_pay_detail.cleanAutoIncrement",detailId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<WxPayDetailDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("wx_pay_detail.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("wx_pay_detail.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(WxPayDetailDO wxPayDetail) {
        try {
            getSqlMapperW().update("wx_pay_detail.updateByIdSelective",wxPayDetail);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public List<WxPayDetailDO> getWxPayDetailByOrderId(Long orderId) {
        return getSqlMapClientTemplate().queryForList("wx_pay_detail.getWxPayDetailByOrderId", orderId);
    }

}

